package com.util;

import android.util.Base64;

public class BASE64Tool     
{     
    
//    /**    
//     * BASE64解密java   
//   * @param key          
//     * @return          
//     * @throws Exception          
//     */              
//    public static byte[] decryptBASE64(String key) throws Exception {               
//        return (new BASE64Decoder()).decodeBuffer(key);               
//    }               
//                  
//    /**         
//     * BASE64加密 java 
//   * @param key          
//     * @return          
//     * @throws Exception          
//     */              
//    public static String encryptBASE64(String sourceStr) throws Exception {               
//        return (new BASE64Encoder()).encodeBuffer(sourceStr.getBytes()).trim();               
//    }       
    /**    
     * BASE64解密  android 
     * @param inStr          
     * @return          
     * @throws Exception          
     */              
    public static String decryptBASE64(String inStr) throws Exception {  
    	return new String(Base64.decode(inStr,Base64.DEFAULT)).trim();
    	
    	              
    }               
    
    /**         
     * BASE64加密   
     * @param key          
     * @return          
     * @throws Exception          
     */              
    public static String encryptBASE64(String sourceStr) throws Exception {      
    	
    	return Base64.encodeToString(sourceStr.getBytes(),Base64.DEFAULT).trim();
    }       
   
}    
